package com.xl.sst.biz.impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.xl.sst.biz.GoodsBiz;
import com.xl.sst.vo.BigClass;
import com.xl.sst.vo.Goods;
import com.xl.sst.vo.Page;
import com.xl.sst.vo.SmallClass;
import com.xl.sst.dao.GoodsDao;

@Service
public class GoodsBizImpl implements GoodsBiz{

	@Resource
	private GoodsDao GoodsDao;
	public GoodsDao getGoodsDao() {
		return GoodsDao;
	}
	public void setGoodsDao(GoodsDao goodsDao) {
		GoodsDao = goodsDao;
	}
	//分页获取商品
	public List<Goods> selectAllByPage(Page p) {
		return GoodsDao.selectAllByPage(p);
	}
	//获取长度
	public int getCount(Page p) {
		return GoodsDao.getCount(p);
	}
	//添加商品
	public boolean add(Goods g) {
		return GoodsDao.add(g)==1?true:false;
	}
	//删除商品
	public int delete(Goods g) {
		return GoodsDao.delete(g);
	}
	public boolean update(Goods g) {
		return GoodsDao.update(g)==1?true:false;
	}
	//获取商品大分类
	public List<BigClass> getBigClass() {
		return GoodsDao.getBigClass();
	}
	//获取商品小分类
	public List<SmallClass> getSmallClass(SmallClass s) {
		return GoodsDao.getSmallClass(s);
	}
	//获取各商店的商品长度
	public int getCountByShop(Page p) {
		return GoodsDao.getCountByShop(p);
	}
	//根据大分类id获取各商店的商品
	public List<Goods> selectAllByShop(Page p) {
		return GoodsDao.selectAllByShop(p);
	}
	//根据id获取商品小分类
	public SmallClass getSClassById(SmallClass s) {
		return GoodsDao.getSClassById(s);
	}
	//根据id获取商品
	public Goods selectById(Goods g) {
		return GoodsDao.selectById(g);
	}
	//获取所有小分类
	public List<SmallClass> getAllSmallClass() {
		return GoodsDao.getAllSmallClass();
	}

}
